/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package websrv;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author sexta13
 */
@Entity
@Table(name = "ITEM_FEED")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ItemFeed.findAll", query = "SELECT i FROM ItemFeed i"),
    @NamedQuery(name = "ItemFeed.findById", query = "SELECT i FROM ItemFeed i WHERE i.id = :id"),
    @NamedQuery(name = "ItemFeed.findByRangeDates", query = "SELECT i FROM ItemFeed i WHERE i.publicationDate  > :dateI and i.publicationDate < :dateF"),
    @NamedQuery(name = "ItemFeed.findByUrlLink", query = "SELECT i FROM ItemFeed i WHERE i.urlLink = :urlLink"),
    @NamedQuery(name = "ItemFeed.findByPublicationDate", query = "SELECT i FROM ItemFeed i WHERE i.publicationDate = :publicationDate"),
    @NamedQuery(name = "ItemFeed.findByTitle", query = "SELECT i FROM ItemFeed i WHERE i.title = :title"),
    @NamedQuery(name = "ItemFeed.findByDescription", query = "SELECT i FROM ItemFeed i WHERE i.description = :description")})
public class ItemFeed implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "URL_LINK")
    private String urlLink;
    @Basic(optional = false)
    @Column(name = "PUBLICATION_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date publicationDate;
    @Basic(optional = false)
    @Column(name = "TITLE")
    private String title;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION")
    private String description;

    public ItemFeed() {
    }

    public ItemFeed(Integer id) {
        this.id = id;
    }

    public ItemFeed(Integer id, String urlLink, Date publicationDate, String title, String description) {
        this.id = id;
        this.urlLink = urlLink;
        this.publicationDate = publicationDate;
        this.title = title;
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUrlLink() {
        return urlLink;
    }

    public void setUrlLink(String urlLink) {
        this.urlLink = urlLink;
    }

    public Date getPublicationDate() {
        return publicationDate;
    }

    public void setPublicationDate(Date publicationDate) {
        this.publicationDate = publicationDate;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemFeed)) {
            return false;
        }
        ItemFeed other = (ItemFeed) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "websrv.ItemFeed[ id=" + id + " ]";
    }
    
}
